<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Raspberry Pi Pico W</title>
    </head>
    <body>
        <h1>Success</h1>
        <p>The Raspberry Pi Pico W is connected to the network!</p>
        <p>Pico internal temperature: <span id="tempValue"></span>C.</p>
        <br/>
        <button id="toggleBtn">Toggle LED</button>
        <button id="resetBtn">Reset Wifi</button>
        <script src="data:text/javascript,document.getElementById('toggleBtn').onclick = async function() { await fetch('/toggle'); };" defer></script>
        <script src="data:text/javascript,document.getElementById('resetBtn').onclick = function() { window.location.href = '/reset'; };" defer></script>
        <script src="data:text/javascript,async function getTemp() { const elem = document.getElementById('tempValue'); elem.innerHTML = 'Updating...'; const t = await fetch('/temperature'); const tVal = await t.text(); elem.innerHTML = tVal; setTimeout(getTemp, 10000)}; getTemp();" defer></script>
    </body>
</html>